Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements various Ruff linting rule fixes (Ruff152) to improve code quality and consistency across the codebase.
Changes:
- Simplified return statements by removing unnecessary intermediate variable assignments
- Consolidated import statements using
fromimports where appropriate - Replaced string manipulation patterns with built-in methods like
removesuffix(),removeprefix(), andstartswith()with tuple arguments - Updated type hints to use
Literal["A", "B"]instead ofLiteral["A"] | Literal["B"] - Replaced manual list building loops with list comprehensions
Reviewed changes
Copilot reviewed 63 out of 63 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/testlib.py | Removed unnecessary pass statement after variable assignment |
| test/test_target.py | Changed import style from import X as Y to from X import Y for clrandom |
| test/test_split_iname_slabs.py | Simplified return statements by removing intermediate variable assignments |
| test/test_numa_diff.py | Replaced manual string suffix removal with removesuffix() method |
| test/test_nbody.py | Simplified multiple return statements by removing intermediate variables |
| test/test_loopy.py | Consolidated imports using from syntax |
| test/test_linalg.py | Simplified return statements across multiple variant functions |
| test/test_dg.py | Removed intermediate variable assignments before returns |
| test/test_apps.py | Simplified return statements in multiple test variant functions |
| test/gnuma_loopy_transforms.py | Removed intermediate variables before return statements |
| pyproject.toml | Added new Ruff rule exclusions and updated per-file ignores |
| loopy/type_inference.py | Simplified control flow by removing redundant else after raising exception |
| loopy/translation_unit.py | Renamed abc_Set to AbstractSet for clarity |
| loopy/transform/subst.py | Removed intermediate variable assignment before return |
| loopy/transform/parameter.py | Updated type hints and simplified return statements |
| loopy/transform/padding.py | Updated Literal type hints to use comma-separated syntax |
| loopy/transform/loop_fusion.py | Renamed Set import to AbstractSet and simplified returns |
| loopy/transform/instruction.py | Added type hints and marked unused parameters with del |
| loopy/transform/iname.py | Renamed Set to AbstractSet, simplified returns and conditionals |
| loopy/transform/fusion.py | Simplified chained comparison expressions |
| loopy/transform/diff.py | Removed intermediate variable before return |
| loopy/transform/data.py | Replaced manual list building with list comprehension |
| loopy/transform/buffer.py | Removed unnecessary assignment and intermediate variable |
| loopy/transform/batch.py | Simplified return statement |
| loopy/transform/array_buffer_map.py | Added assertion and simplified return |
| loopy/transform/add_barrier.py | Removed intermediate variable before return |
| loopy/tools.py | Updated function signatures with type hints, replaced string methods with built-ins |
| loopy/target/python.py | Converted loop-based list building to list comprehension |
| loopy/target/pyopencl.py | Simplified conditional logic and removed deprecated property |
| loopy/target/opencl.py | Updated Literal type hints |
| loopy/target/execution.py | Renamed Set import to AbstractSet |
| loopy/target/c/compyte | Updated subproject commit hash |
| loopy/target/c/codegen/expression.py | Removed intermediate variable before return |
| loopy/target/c/c_execution.py | Changed exception type, removed pass statement, replaced string concatenation |
| loopy/target/c/init.py | Updated regex flag from re.M to re.MULTILINE |
| loopy/target/init.py | Reordered Generic type parameter position |
| loopy/symbolic.py | Renamed Set to AbstractSet throughout, converted loops to comprehensions |
| loopy/statistics.py | Converted dictionary building loops to comprehensions, removed unused function |
| loopy/schedule/tools.py | Renamed Set to AbstractSet |
| loopy/schedule/device_mapping.py | Removed intermediate variable before return |
| loopy/schedule/init.py | Replaced TypeVar with Self, renamed Set to AbstractSet |
| loopy/preprocess.py | Simplified return statements |
| loopy/match.py | Simplified range expression |
| loopy/library/reduction.py | Removed intermediate variables and unnecessary return statements |
| loopy/library/random123.py | Removed unnecessary return statement |
| loopy/kernel/tools.py | Renamed Set to AbstractSet, added type hints, improved loop efficiency |
| loopy/kernel/instruction.py | Renamed abc_Set to AbstractSet, removed pass statement |
| loopy/kernel/function_interface.py | Renamed Set to AbstractSet, reformatted method signatures |
| loopy/kernel/creation.py | Updated Literal type hints, converted loops to comprehensions |
| loopy/kernel/init.py | Renamed Set to AbstractSet, added type hints, converted loops to comprehensions |
| loopy/frontend/fortran/translator.py | Removed intermediate variable before return |
| loopy/frontend/fortran/expression.py | Updated regex flags to use named constants |
| loopy/frontend/fortran/init.py | Consolidated imports, added noqa comments for exec usage |
| loopy/diagnostic.py | Removed unnecessary pass statement |
| loopy/codegen/instruction.py | Renamed Set to AbstractSet |
| loopy/codegen/control.py | Renamed Set to AbstractSet |
| loopy/cli.py | Added noqa comments for exec usage |
| examples/python/ispc-stream-harness.py | Simplified return statements |
| examples/python/call-external.py | Removed unnecessary return statement |
| examples/fortran/matmul-driver.py | Changed import style |
| contrib/mem-pattern-explorer/pattern_vis.py | Reordered imports |
| contrib/c-integer-semantics.py | Removed shebang and blank line |
| .basedpyright/baseline.json | Updated baseline for type checking |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.